<%--
  @desc: 应用查看或编辑页面
  @author: chenw
  @create: 2014-4-29 下午 15:32
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style type="text/css">
    .pageContent label {
        width: 100px;
    }
    .pageFormContent p {
        width: 430px;
    }
    
   
    .uploadify-queue {
        float: left;
        display: inline-block;
        height: 20px;
        line-height: 20px;
        margin: 0;
        margin-top: 20px;
    }
    .uploadify-queue-item {
        margin: 0;
        height: 20px;
        padding: 0;
        margin-left: 10px;
        width: 400px;
    }
    .uploadify-queue-item .cancel {
        padding-top: 1px;
    }
    .uploadify-queue-item .cancel a {
        float: right;
        height: 16px;
        font-size: 11px;
        margin-left: 5px;
        margin-right: 5px;
        line-height: 16px;
        background-image: none;
        width: 30px;
        text-indent: 5px;
        cursor: pointer;
        text-decoration: none;
    }
    .uploadify-queue-item .fileName, .uploadify-queue-item .data {
        font-size: 11px;
        color: gray;
    }
    .uploadify-queue-item .uploadify-progress {
        margin: 0;
        margin-top: 3px;
    }
    #icon_show {
        display: inline-block;
        line-height: 20px;
        text-indent: 10px;
        color: gray;
        width: 60px;
        height: 60px;
        margin-left: 10px;
        border: 1px solid #ccc;
        border-radius: 3px;
    }
</style>
<!--/sys/app/edit'-->
<div class="pageContent" style="padding-top: 1px;">
    <form method="post" action="<c:url value='/monitor/new'/>" class="pageForm required-validate"
            onsubmit="return validateCallback(this, apiEditCallback);" enctype="multipart/form-data">
        <div class="pageFormContent" layoutH="56">
            <p>
                <label>接口名称：</label> <input name="apiName" type="text" size="30" style="width:250px;" class="required"/>
                <input type="hidden" id="count" name ="count" value="${count}"/>
            </p>
			<p style="width: 100%;">
                <label>接口描述：</label> 
                <textarea cols="60" rows="4" name="apiDesc"
                    style="width:250px;"></textarea>
            </p>
            <p></p>
            <p></p>
			<p>
                <label>接口地址：</label> <input name="url" type="text" size="30" style="width:250px;" class="required" />
            </p>
			<p>
                <label>接口方式：</label>
                <select name="cate" class="required combox">
                	 <option  value="WebAPI">WebAPI
                   </option>
                    <option value="WebService">WebService
                    </option>
                </select>
            </p>
            <p>
                <label>请求方式：</label>
                <select name="isPost" class="required combox">
                	 <option value=1
                            <c:if test="${api.isPost eq 1}">selected="selected"</c:if> >POST
                    </option>
                    <option value=0
                            <c:if test="${api.isPost eq 0}">selected="selected"</c:if> >GET
                    </option>
                    <option value=2
                            <c:if test="${api.isPost eq 2}">selected="selected"</c:if> >DELETE
                    </option>
                </select>
            </p>
            
            <p id="pppp0">
                <label>请求参数：</label>
                <input  style="width:50px;margin-right:5px;"  id="paramname" name="paramName0" type="text" size="30" />
                <label>参数值：</label>
                <input style="width:50px;" id="paramvalue" name="paramValue0" type="text" size="30" />
               
                <span onclick="addP();">
				<img src="<c:url value='/resource/images/plus.png'/>" width="15px;" hight="15px"  alt="jia" />
				</span>
            </p>
   		 
            <p>
                <label>间隔时间：</label>
                <input name="timeInterval"  type="text" size="30"  style="width:50px;"
                        class="required" />分钟
            </p>

            <p>
                <label>容错次数：</label>
                <input name="errorNum"  type="text" size="30" style="width:70px;"
                        class="textInput"/>
            </p>
             <p>
                <label for="txt_user_tel">联系电话：</label>
                <input id="txt_user_tel" type="text" name="phone" class="tel" maxlength="300" style="width:250px;"/>
            </p>
            
            <p>
                <label>短信间隔时间：</label>
                <input name="mesInterval"  type="text" size="30" style="width:80px;"
                        class="textInput"/>分钟
            </p>
       
           
            <input type="hidden" name="id" value="${api.id}"/>
            <input type="hidden" name="status" value="1"/>
            <input type="hidden" id="pluginMd5" name="pluginMd5" value="${count}">
         

        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">保存</button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="button" class="close" >取消</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
<script type="text/javascript">
   
  
    function apiEditCallback(resp) {
        if (resp && resp.succ) {
            alertMsg.info("操作成功！");
            $.pdialog.closeCurrent();
            navTab.reloadFlag('page_sys_vehicle');
           // resp.id 
         //  alert(resp.data.id);
        
           test(resp.data.id);
        } else {
            alertMsg.info(resp.msg + "!");
        }
    }
    var count = "${count}"+1;
    function addP(){
    	var html = " <p id='pppp"+count+"'> <label>请求参数：</label><input  style='width:52px;margin-right:10px;'  name='paramName"+count+"' type='text' size='30' /><span style='margin-left:52px;'>参数值：</span><input  style='width:52px;margin-left:5px;'  name='paramValue"+count+"' type='text' size='30' /><span onclick=\"delParam('pppp"+count+"')\"><img src=\"<c:url value='/resource/images/minus.png'/>\" width=\"15px;\" hight=\"15px\"  alt=\"jian\" /></span></p>";
    	c= parseInt(count) -1;
    	$("#pppp0").after(html);
    	$("#count").val(count);
    	count++;
    }
    function delParam(id){
    	$("#"+id).remove();
    	count--;
    }
    
    </script>
 

